#该代码用于计算均值、方差、标准差
import numpy as np
import numpy.matlib

def get_mean_var_std(arry):
    #求均值
    arry_mean = np.mean(arry)
    #求方差
    arry_var = np.var(arry)
    #求标准差
    arry_std = np.std(arry,ddof=1)
    print("平均值为：%f" % arry_mean)
    print("方差为：%f" % arry_var)
    print("标准差为:%f" % arry_std)

    return arry_mean ,arry_var ,arry_std

if __name__ == '__main__':
    m1 = np.matlib.rand((1,1000))#生成矩阵1
    m2 = np.matlib.rand((1000,1))#生成矩阵2
    arry1 = [1, 2, 3, 4, 5, 6]#数组1
    arry2 = [0.0010, 0.0056, 0.6738, 0.3196]#数组2
    W_p = np.array([[-0.12],[1.0525],[0.0],[2.77]])
    W_a = np.array([[-1.16],[1.3625],[0.0],[1.21]])
    W_d = np.array([[-0.60],[1.2100],[0.0],[1.42]])
    E_p = np.dot(arry2,W_p)#arry2,W_p点乘
    E_a = np.dot(arry2,W_a)#arry2,W_a点乘
    E_d = np.dot(arry2,W_d)#arry2,W_d点乘
    print(get_mean_var_std(m1),get_mean_var_std(m2),get_mean_var_std(arry1))
    print(E_p,E_a,E_d)#输出矩阵相乘结果
    avg = (E_p + E_a + E_d)/3#输出平均值
    print(avg)